<?php
// +----------------------------------------------------------------------
// | 系统基类
// +----------------------------------------------------------------------

class fee {
	private static $_instance = array();

	//自动变量设置
	public function __set($name ,$value) {
		if(property_exists($this,$name))
		$this->$name = $value;
	}

	//自动变量获取
	public function __get($name) {
		return isset($this->$name)?$this->$name:null;
	}

	/**
     * 取得对象实例 支持调用类的静态方法
     * @param string $class 对象类名
     * @param string $method 类的静态方法名
     * @return object
     */
	static public function instance($class,$method='') {
		$identify = $class.$method;
		if(!isset(self::$_instance[$identify])) {
			if(class_exists($class)){
				$o = new $class();
				if(!empty($method) && method_exists($o,$method))
				self::$_instance[$identify] = call_user_func_array(array(&$o, $method));
				else
				self::$_instance[$identify] = $o;
			}
			else
				halt(L('_CLASS_NOT_EXIST_')." [$class]");
		}
		return self::$_instance[$identify];
	}

}